package com.is.dmd;

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.is.base.BaseAppManager;
import com.is.common.utils.LogUtils;

/**
 * Created by Administrator on 2016/8/19.
 *
 * http://blog.csdn.net/u011275280/article/details/51833974  方法数超过 65536 上限
 */
public class DMDApplication extends Application {
    private static Context sContext;
    public static Context getContext(){
        return sContext;
    }
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
    @Override
    public void onCreate() {
        super.onCreate();
        sContext=this;
        LogUtils.init(this);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

    /**
     * 退出app需要清除所有activity
     */
    public void exitApp() {
        //清除所有activity   BaseAppManager:  activity管理器
        BaseAppManager.getInstance().clear();
        System.gc();
        android.os.Process.killProcess(android.os.Process.myPid());
    }

}
